<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" type="text/css" href="http://unpkg.com/view-design/dist/styles/iview.css">
    <script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>
    <script type="text/javascript" src="http://unpkg.com/view-design@4.0.2/dist/iview.min.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <template v-if=" type === 'name'">
            <label for="用户名"></label>
            <input type="text" placeholder="请输入用户名" key="name-input">
        </template>
        <template v-else>
            <label for="邮箱"></label>
            <input type="text" placeholder="请输入邮箱" key="mail-input">
        </template>
        <button @click="handleToggleClick">切换数据类型</button>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                type:'name'
            },
            methods:{
                handleToggleClick:function(total){
                    this.type = this.type === 'name' ? 'mail' : 'name';
                }
            }
        })

    </script>
</body>
</html>